package com.tensquare.user.controller;

import com.tensquare.user.pojo.User;
import com.tensquare.user.server.UserServer;
import entity.Result;
import entity.StatusCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author wz
 * @company 公司
 * @create 2020-02-10 16:25
 */
@RestController
@RequestMapping("user")
public class UserController {
    @Autowired
    private UserServer userServer;
    //根据id查询用户
    //http://127.0.0.1:9008/user/1
    @GetMapping("{userId}")
    public Result selectById(@PathVariable("userId") String userId){
        User user = userServer.selectById(userId);
        return new Result(true, StatusCode.OK,"用户查询成功",user);
    }
}
